<template>
  <div class="code">
    <div class="right-account-login">
      <p type="text" class="code-title-login" @click="returnPhoneLogin">账号登录></p>
    </div>
    <div class="block">
      <VueQr
        v-if="qrLoginId"
        :correctLevel="3"
        :logoScale="0.4"
        :size="200"
        :margin="0"
        :dotScale="1"
        :text="`XiaoLanDouLogin&${qrLoginId}`"
      ></VueQr>
    </div>
    <div>
      <p class="code-title-mobile">使用{{productName}}IM手机版扫码登录</p>
    </div>
  </div>
</template>

<script>
import VueQr from 'vue-qr'
import { mapState } from 'vuex'
export default {
  components: { VueQr },
  props: ['qrLoginId'],
  computed: {
    ...mapState({
      productName: state => state.settings.productName,
      version: state => state.settings.version
    })
  },
  data: function () {
    return {
      backgroundColor: '#000',
      colorDark: '#000',
      colorLight: '#ffffff'
    }
  },
  methods: {
    returnPhoneLogin () {
      this.$emit('onChangeLodeStatus', 1)
      sessionStorage.clear()
    }
  }
}
</script>

<style lang="scss">
body {
  background: #666666;
}
.code {
  width: 297px;
  height: 401px;
  background: rgba(255, 255, 255, 1);
  border-radius: 9px;
  text-align: center;
  margin: auto;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  .right-account-login {
    text-align: right;
    .code-title-login {
      font-size: 14px;
      font-family: Source Han Sans CN;
      font-weight: 400;
      color: #3478f5;
      margin-right: 20px;
      margin-top: 20px;
      margin-bottom: 20px;
      cursor: pointer;
    }
  }
  .login-remember {
    margin-top: 10px;
  }
  .code-title {
    font-size: 25px;
    font-family: Source Han Sans CN;
    font-weight: 500;
    color: rgba(0, 0, 0, 1);
    margin-bottom: 5px;
  }
  .code-title-mobile {
    font-size: 14px;
    font-weight: 400;
    color: #999999;
    margin-top: 45px;
  }
  .block {
    margin: auto;
    margin-top: 10px;
    margin-bottom: 25px;
    width: 190px;
    height: 190px;
  }
}
</style>
